package cc.telecomdigital.tdstock.Tools;

public class CDR_ErDefinition
{
	public enum CDR_STATUS { SUCCESS, SQL_EXCEPTION, EXCEPTION, INV_BASE, INV_ACCOUNT,
						INV_LOGIN, INV_DVCID, INV_SVCINFO, INV_DVCTYPE, INV_SVCTYPE,
						INV_SVCSUBTYPE, INV_SVCVALUE, INV_SESSSTART, INV_SESSEND, INV_DVCTIME,
						INV_SEQNO, INV_LSTIME, INVALID_VALUE }
	
	private static final int CDR_STAT_SUCCESS = 0;
	private static final int CDR_STAT_SQL_EXCEPTION = 202;
	private static final int CDR_STAT_EXCEPTION = 209;
	private static final int CDR_STAT_INV_BASE = 300;
	private static final int CDR_STAT_INV_ACCOUNT = 301;
	private static final int CDR_STAT_INV_LOGIN = 302;
	private static final int CDR_STAT_INV_DVCID = 303;
	private static final int CDR_STAT_INV_SVCINFO = 304;
	private static final int CDR_STAT_INV_DVCTYPE = 305;
	private static final int CDR_STAT_INV_SVCTYPE = 306;
	private static final int CDR_STAT_INV_SVCSUBTYPE = 307;
	private static final int CDR_STAT_INV_SVCVALUE = 308;
	private static final int CDR_STAT_INV_SESSSTART = 309;
	private static final int CDR_STAT_INV_SESSEND = 310;
	private static final int CDR_STAT_INV_DVCTIME = 311;
	private static final int CDR_STAT_INV_SEQNO = 312;
	private static final int CDR_STAT_INV_LSTIME = 313;
			
	public static CDR_STATUS GetDefinitionFromString(int iValue)
	{
		switch(iValue)
		{
			case CDR_STAT_SUCCESS:
				return CDR_STATUS.SUCCESS;
			case CDR_STAT_SQL_EXCEPTION:
				return CDR_STATUS.SQL_EXCEPTION;
			case CDR_STAT_EXCEPTION:
				return CDR_STATUS.EXCEPTION;
			case CDR_STAT_INV_BASE:
				return CDR_STATUS.INV_BASE;
			case CDR_STAT_INV_ACCOUNT:
				return CDR_STATUS.INV_ACCOUNT;
			case CDR_STAT_INV_LOGIN:
				return CDR_STATUS.INV_LOGIN;
			case CDR_STAT_INV_DVCID:
				return CDR_STATUS.INV_DVCID;
			case CDR_STAT_INV_SVCINFO:
				return CDR_STATUS.INV_SVCINFO;
			case CDR_STAT_INV_DVCTYPE:
				return CDR_STATUS.INV_DVCTYPE;
			case CDR_STAT_INV_SVCTYPE:
				return CDR_STATUS.INV_SVCTYPE;
			case CDR_STAT_INV_SVCSUBTYPE:
				return CDR_STATUS.INV_SVCSUBTYPE;
			case CDR_STAT_INV_SVCVALUE:
				return CDR_STATUS.INV_SVCVALUE;
			case CDR_STAT_INV_SESSSTART:
				return CDR_STATUS.INV_SESSSTART;
			case CDR_STAT_INV_SESSEND:				
				return CDR_STATUS.INV_SESSEND;
			case CDR_STAT_INV_DVCTIME:
				return CDR_STATUS.INV_DVCTIME;
			case CDR_STAT_INV_SEQNO:
				return CDR_STATUS.INV_SEQNO;
			case CDR_STAT_INV_LSTIME:
				return CDR_STATUS.INV_LSTIME;			
		}
		
		return CDR_STATUS.INVALID_VALUE;
	}

	public static String CDRStatusValueToString(int iValue)
	{
		CDR_STATUS statValue;
		
		statValue = GetDefinitionFromString(iValue);
		
		return statValue.toString();		
	}
}
